package com.ruoyi.web.controller.orderview;

import com.ruoyi.orderview.service.impl.ChartsServiceImpl;
import com.ruoyi.orderview.utils.DateDispose;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;
import com.ruoyi.orderview.domain.ProductionParam;

import java.util.List;
import java.util.Map;
/**
        * Author 许家森
        * Date 2022/2/22
        * Email 3448324670@qq.com
 */

@RestController
@Api("生产资料折线图")
@CrossOrigin
public class ProductionViewController {
    @Autowired
    private DateDispose dateDispose;
    @Autowired
    private ChartsServiceImpl chartsService;
    @PostMapping("view/ProductionsCharts")
    @ApiOperation("生产资料折线图数据")
    public List<List<Map<Object,Object>>> Charts(@RequestBody ProductionParam productionParam) {
        String type = productionParam.getProductiontype();
        if (type.equals("blade") || type.equals("carton") || type.equals("graftinglabel")
                || type.equals("fertilizer") || type.equals("graftingclip")
                || type.equals("greenhousefilm") || type.equals("pesticide")
                || type.equals("plug") || type.equals("regulator")
                || type.equals("seed") || type.equals("stroma") ){
            return chartsService.selectPurchase(dateDispose.DateDisposes(productionParam));
        }
        return null;
    }
}
